import 'package:hive/hive.dart';

part 'message_model.g.dart';

@HiveType(typeId: 7)
class MessageModel extends HiveObject {
  @HiveField(0)
  String id;

  @HiveField(1)
  String chatId;

  @HiveField(2)
  String senderId;

  @HiveField(3)
  String content;

  @HiveField(4)
  bool isEmoji;

  @HiveField(5)
  String? emojiPath;

  @HiveField(6)
  bool isTeamInvite;

  @HiveField(7)
  String? teamId;

  @HiveField(8)
  DateTime sentAt;

  @HiveField(9)
  bool isRead;

  MessageModel({
    required this.id,
    required this.chatId,
    required this.senderId,
    required this.content,
    this.isEmoji = false,
    this.emojiPath,
    this.isTeamInvite = false,
    this.teamId,
    required this.sentAt,
    this.isRead = false,
  });

  // 标记为已读
  void markAsRead() {
    isRead = true;
  }
}
